package br.com.aquinoevasconcelos.servlets.informativo;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import br.com.aquinoevasconcelos.fachada.Fachada;

/**
 * Servlet implementation class ver2Informativo
 */
@WebServlet("/Ver2Informativo")
public class Ver2Informativo extends HttpServlet {
	private static final long serialVersionUID = 1L;
       

    public Ver2Informativo() {
        super();

    }
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    	
		
		Fachada fachada = Fachada.getInstancia();
		
		String codigo = request.getParameter("id");
		System.out.println(codigo);
		long id = Long.parseLong(codigo);
		
		try {
			
			request.setAttribute("verInformativo",fachada.EditarInformativo(id));
			
    		request.getRequestDispatcher("admin/ver_informativo.jsp").forward(request, response);
			
		} catch (Exception e) {
			request.getRequestDispatcher("../erro.jsp").forward(request, response);
		}
    	
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		service(request, response);

	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		service(request, response);

	}

}
